package com.qfedu.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 作者：刘随阳
 * 时间: 2021/9/22 17:25
 * 描述：神光照耀,太白成瑞。六丙来迎,百福悠归
 */
@Configuration
public class RedissonConfig {

    @Value("${redisson.addr.singleAddr.host}")
    private String host;


    @Value("${redisson.addr.singleAddr.database}")
    private int database;

    @Bean
    public RedissonClient getRedissonClient(){
        Config config = new Config();
        config.useSingleServer().setAddress(host).setDatabase(database);
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;
    }

}